package com.shujia.java.day17.demo1;

import java.io.BufferedInputStream;
import java.io.FileInputStream;

/**
 * @Description: Demo2  ��������
 * @Author: �����
 * @Date: 2019/8/19 9:04
 */
public class Demo2 {
    public static void main(String[] args) throws Exception {
        // �ֽ����뻺����
        FileInputStream fis = new FileInputStream("F:\\data\\test.txt");
        // ������ ����ָ����С ��������Ĭ�ϵ�(Ĭ�ϴ�С��ʹ�ã�ͨ�������ָ��һ������)
        BufferedInputStream bis = new BufferedInputStream(fis);
        //������
       // BufferedInputStream bis = new BufferedInputStream(new FileInputStream("F:\\data\\test.txt"));

//        int i;
//        while ((i = bis.read()) != -1) {
//            System.out.println((char)i);
//        }

        byte[] bytes = new byte[1024];
        int i;
        while ((i = bis.read(bytes)) != -1) {
            System.out.println(new String(bytes,0,i));
        }


        //�ر��� �ͷ���Դ
        //���������Թر� ����ֱ�ӹرջ������Ϳ�����(�رջ���������ֱ�ӹر��ֽ���)
        bis.close();


    }
}
